package com.sg.java.enums;

/**
 * @Description: 电压等级枚举
 * @Author: ZhouKaiQiang
 * @CreateTime: 2022/7/15 下午 9:08
 */
public enum VoltageLevelEnum {
    AC02202(1, "0107"),
    AC03802(2, "0108"),
    AC00061(3, "0116"),
    AC00101(4, "0117"),
    AC00201(5, "0119"),
    AC00351(6, "0121"),
    AC00661(7, "0122"),
    AC01101(8, "0123"),
    AC02201(9, "0124"),
    AC03301(10, "0125"),

    AC01102(28,"110V"),
    AC05001(21,"0126"),
    AC00062(23,"6V"),
    AC00031(24,"0115"),

    ;

    VoltageLevelEnum(int code, String name) {
        this.code = code;
        this.name = name;

    }

    private int code;

    private String name;


    public int getCode() {
        return code;
    }

    public String getName() {
        return name;
    }


    public static Integer getCode(String remark) {
        VoltageLevelEnum voltageLevelEnum = VoltageLevelEnum.valueOf(remark);
        return voltageLevelEnum.getCode();
    }




    public static int getCodeByDescription(String description) {
        for (VoltageLevelEnum voltageLevel : VoltageLevelEnum.values()) {
            if (voltageLevel.getName().equals(description)) {
                return voltageLevel.getCode();
            }
        }
        // 如果找不到对应description的枚举常量，可以返回一个特定的值或者抛出异常，取决于你的需求
        return -1; // 或者抛出自定义异常
    }







}
